package cn.chinahadoop.scala

class Basic5 {
  
}

object Basic5 extends App{
  val value = 2
  val result = value match {
    case 1 => "one"
    case 2 => "two"
    case _ => "some other number"
  }
  
  val result2 = value match {
    case i if i == 1 => "one"
    case i if i == 2 => "two"
    case _ => "some other number"
  }
  
  println("result of match is : " + result)
  println("result2 of match is : " + result2)
  
  def t(obj : Any) = obj match {
    case x : Int => println("Int")
    case s : String => println("String")
    case _ => println("unknown type")
  }
  
  t("s")
}